package com.gitee.zw.irmp.common.auth.oauth2.welink;

import com.gitee.zw.irmp.common.auth.oauth2.DefaultOAuth2SSOProcessor;
import org.springframework.http.HttpHeaders;

import java.util.Map;

public class WeLinkOAuth2SSOProcessor extends DefaultOAuth2SSOProcessor {

    public static final String USER_ID_KEY = "userId";

    @Override
    protected void setAuthToken(HttpHeaders headers, String token) {
        headers.set("x-wlk-Authorization", token);
    }

    protected boolean validUserInfo(Map<String, Object> userInfo) {
        return userInfo != null && userInfo.containsKey(USER_ID_KEY);
    }
    protected boolean validUserDetail(Map<String, Object> userDetail) {
        return userDetail != null && userDetail.containsKey(USER_ID_KEY);
    }
}
